> X<-c(1, 2, 3, 4, 5)
> Y<-c(3, 6, 4, 9 ,8)
> cor(X, Y, method='pearson')
[1] 0.8062258
> X<-c(1, 2, 3, 4, 5)
> Y<-c(3, 6, 4, 9 ,8)
> cor(X, Y, method='spearman')
[1] 0.8
time | 학습시간(시간) | 8 | 6 | 7 | 3 | 2 | 4 | 2 | 7 | 2 | 3 |
score | 점수(점) | 33 | 22 | 18 | 6 | 23 | 10 | 9 | 30 | 11 | 13 |
> time<-c(8, 6, 7, 3, 2, 4, 2, 7, 2, 3)
> score<-c(33, 22, 18, 6, 23, 10, 9, 30, 11, 13)
> cor.test(time, score)
Pearson's product-moment correlation
data: time and score
t = 3.0733, df = 8, p-value = 0.01527
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.1978427 0.9331309
sample estimates:
cor
0.7358112